<?php
namespace app\console\task;

use think\console\Input;
use think\console\input\Option;
use think\console\Output;

class TimeRun extends \think\console\Command {

    public $name;

    protected function configure() {
        $this->setName('timerun')->addOption('name', null, Option::VALUE_REQUIRED,'', 'gongzheng')
            ->addOption('age', null, Option::VALUE_REQUIRED, '25')
            ->addArgument('address', NULL)->addArgument('tel', null)      //设置参数顺序，决定了命令行的写参数的顺序
            ->setDescription('first command');
    }

    protected function execute(Input $input, Output $output) {
        $test = \think\Db::name('`test.com`')->select(1);
        echo json_encode($test, JSON_UNESCAPED_UNICODE);
    }

}
